package com.gugee.tiktok.common.model.constant;

/**
 * 人脸识别
 */
public enum FaceRecognitionCodeEnum {

    SUCCESS(0,"分析成功"),
    PIC_DOWNLOAD_ERROR(1002,"图片下载问题"),
    IMPL_ERROR(1003,"程序异常"),
    QPS_FULL(18,"qps上限"),
    PIC_NO_FACE(222202,"图片无人脸"),
    UNKNOWN(-1,"未知");

    /**
     * 返回码
     */
    int code;
    /**
     * 解释
     */
    String desc;

    FaceRecognitionCodeEnum(int code,String desc){
        this.code = code;
        this.desc = desc;
    }

    /**
     * 获取编码
     * @return
     */
    public int getCode() {
        return code;
    }

    /**
     * 获取描述
     * @return
     */
    public String getDesc() {
        return desc;
    }

    /**
     * 根据code返回描述
     * @return
     */
    public static FaceRecognitionCodeEnum getEnumByCode(int code) {
        for(FaceRecognitionCodeEnum e : FaceRecognitionCodeEnum.values()){
            if(e.getCode() == code){
                return e;
            }
        }
        return UNKNOWN;
    }
}
